#ifndef     __PROTO_H
#define     __PROTO_H

#include <stdint.h>

namespace conn {

namespace frame {

constexpr uint16_t HEAD = 0xE11E;
constexpr uint8_t HEAD0 = 0xE1;
constexpr uint8_t HEAD1 = 0x1E;
constexpr uint8_t END = 0xEF;

}

namespace type {

constexpr uint8_t ACK = 0;
constexpr uint8_t PING = 1;
constexpr uint8_t PONG = 2;
constexpr uint8_t SESSION = 3;
constexpr uint8_t REQ = 4;
constexpr uint8_t RES = 5;
constexpr uint8_t QUERY = 6;
constexpr uint8_t RESULT = 7;
constexpr uint8_t NOTIFY = 8;
constexpr uint8_t NOTIFY_ACK = 9;


}

namespace proto {

uint8_t make_result(uint8_t *buf, uint8_t cmd, uint8_t data_len);
uint8_t make_notify(uint8_t *buf, uint8_t cmd, uint8_t data_len);
uint8_t make_notify_ack(uint8_t *buf, uint8_t seq, uint8_t cmd, uint8_t data_len);
uint8_t make_res(uint8_t *buf, uint8_t seq, uint8_t cmd, uint8_t data_len);
uint8_t make_ack(uint8_t *buf, uint8_t seq);

}

namespace req_res {

constexpr uint8_t DOOR_CTRL = 1;
constexpr uint8_t NOZZLE_CTRL = 2;
constexpr uint8_t PARTS_CTRL = 3;
constexpr uint8_t DRAW_HEAT_CTRL = 4;
constexpr uint8_t DRAW_WATER_TEST = 5;
constexpr uint8_t SET_STEAM_DRAW_TIMEOUT = 6;
constexpr uint8_t SET_STEAM_HEAT_ARG = 7;
constexpr uint8_t SET_FLOW_ARG = 8;
constexpr uint8_t CLEAN = 0x0A;
constexpr uint8_t COOKING = 0x0B;
constexpr uint8_t RF_TRANSLATE = 0x0C;
constexpr uint8_t OTA_START = 0x0E;
constexpr uint8_t OTA_TRANSLATE = 0x0F;
constexpr uint8_t OTA_COMPLETE = 0x10;
constexpr uint8_t SET_PUMP_ARG = 0x11;
constexpr uint8_t SET_DOOR_ADC = 0x12;

}

namespace notify {

constexpr uint8_t LOG = 0;
constexpr uint8_t STATUS = 1;
constexpr uint8_t RF_NOTIFY = 0x0D;

}

namespace query {

constexpr uint8_t ARGS = 0x09;

}

}

#endif
